﻿using ImTools;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace MyMeeting.Views.Dialogs
{
    /// <summary>
    /// NineGridLayoutView.xaml 的交互逻辑
    /// </summary>
    public partial class NineGridLayoutView : UserControl
    {
        public NineGridLayoutView()
        {
            InitializeComponent();
        }

        private void nineGrid_Loaded(object sender, RoutedEventArgs e)
        {
            double designWidth = 1920;
            double designHeight = 1080;
            double designRatio = designWidth / designHeight;

            double screenWidth = SystemParameters.WorkArea.Width;
            double screenHeight = SystemParameters.WorkArea.Height;

            // 计算目标尺寸
            double targetWidth = screenWidth;
            double targetHeight = screenWidth / designRatio;

            if (targetHeight > screenHeight)
            {
                targetHeight = screenHeight;
                targetWidth = screenHeight * designRatio;
            }

            this.Width = targetWidth;
            this.Height = targetHeight;
            // 计算缩放比例
            double scaleX = targetWidth / designWidth;
            double scaleY = targetHeight / designHeight;
            mainGrid.Width= targetWidth;
            mainGrid.Height = targetHeight;

          //  mainGrid.LayoutTransform = new ScaleTransform(scaleX, scaleY);
        }
    }
}
